package oj;


import java.util.Scanner;

/**
 * @author Liangyaoyun
 */
public class KMP {
    /*A*/
    /*        public static void main(String[] args) {
                Scanner scanner = new Scanner(System.in);
                String a= scanner.nextLine();
                String b=scanner.nextLine();
                int index=scanner.nextInt();
                System.out.print(insert(a,b,index));
            }
            public static char[] insert(String a,String b,int index){
                int lenA=a.length();
                int lenB=b.length();
                char[] strA=a.toCharArray();
                char[] strB=b.toCharArray();
                char[] result=new char[lenA+lenB];
                for (int i = 0; i < index-1; i++) {
                    result[i]=strA[i];
                }
                int size=index-1;
                int len=lenA-index;
                for (int i = 0,j=index-1; i <lenB ; i++) {
                    result[j]=strB[i];
                    j++;
                    index++;
                }
                while (len+1!=0){
                    result[index-1]=strA[size];
                    index++;
                    size++;
                    len--;
                }
                return result;
            }*/
    /*B*/

/*    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String a = scanner.nextLine();
        int index=scanner.nextInt();
        int len=scanner.nextInt();
        String result=a.substring(index-1,index+len-1);
        System.out.print(result);
    }*/
    /*C*/
    /*计算并返回模式串T的next数组的方法*/
    //先计算一个等长相等的next数组，用来选择下一次匹配，匹配串的初始下标
  /*  private static int[] getNextArray(String T) {
        *//*
        1.根据模式串T的长度创建等长的next数组
        并将next[0]置为-1
        *//*
        int[] next = new int[T.length()];
        next[0] = -1;
        *//*
         2.从模式串T的最长子串开始
            由长到短计算每一个子串的
            最长公共前后缀取值
         并将取值填入到下一位的next数组当中
        *//*
        int i = 1;
        int j = 0;
        while (i < next.length - 1) {
            //如果当j==-1时，则说明模式串
            if (j == -1 || T.charAt(i) == T.charAt(j)) {
                next[i + 1] = j + 1;
                i++;
                j++;
            } else {
                j = next[j];
            }
        }
        return next;
    }

    *//**
     * KMP算法代码实现
     * S表示主串 T表示模式串
     */
    /*C*/
    /*
    public static int kmp(String S, String T) {
        if (S == null || T == null || S.length() < T.length()) {
            return -1;
        }
        if (T.length() == 0) {
            return 0;
        }
        //1.根据模式串T的内容计算next数组
        int[] next = getNextArray(T);
        //2.参考next数组取值进行字符串匹配
        int i = 0;
        int j = 0;
        while (i < S.length() && j < T.length()) {
            if (j == -1 || S.charAt(i) == T.charAt(j)) {
                i++;
                j++;
            } else {
                j = next[j];
            }
        }
        //3.判断并返回匹配结果
        if (j == T.length()) {
            return i - j + 1;
        } else {
            return 0;
        }
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String S = scanner.nextLine();
            String P = scanner.nextLine();
            System.out.println(kmp(S, P));
        }
    }*/
    /*D*/
    public static void main(String[] args) {
        Scanner cin=new Scanner(System.in);
        String a= cin.nextLine();
        String b= cin.nextLine();
        char[] strA=a.toCharArray();
        char[] strB=b.toCharArray();
        int i=0;
        int lenA=a.length();
        int lenB=b.length();
        if (a.equals(b)){
            System.out.print(0);
        }else {
            /*lenA跟lenB与i比较防止数组越界抛异常*/
            while (i<lenA&&i<lenB&&strA[i]==strB[i]){
                i++;
            }
            System.out.print(strA[i]-strB[i]);
        }
    }
}
